<?php
	class Shopconfig_model extends CI_Model {

		public function __construct()
		{
			$this->load->database();
		}
		
		public function get_config($id = FALSE)
		{
			if ($id === FALSE)
			{
				$query = $this->db->get('shopconfig');
				return $query->result_array();
			}
	
			$query = $this->db->get_where('shopconfig', array('id' => $id));
			return $query->row_array();
		}
		
		public function set_shopconfig()
		{
			$this->load->helper('url');
	
			//$slug = url_title($this->input->post('title'), 'dash', TRUE);
	
			$data = array(
				'key' => $this->input->post('key'),
				'value' => $this->input->post('value')
			);
	
			return $this->db->insert('shopconfig', $data);
		}
	}
?>
